package com.blog.backend.exception;

import com.blog.backend.config.CodeMsg;

import java.io.Serializable;

public class GlobalException extends RuntimeException implements Serializable {

    private static final long serialVersionUID = -6377142409939810571L;
    private String message;

    private int code;

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public GlobalException(CodeMsg msg) {
        this.message = msg.getMsg();
        this.code=msg.getCode();
    }
    public GlobalException(String message){
        this.message=message;
        this.code=500;
    }
}
